{extend name="main/index" /}
{block name="main"}
<div class="main-content">
    <div class="breadcrumbs" id="breadcrumbs">
        <script type="text/javascript">
            try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
        </script>

        <ul class="breadcrumb">
            <li>
                <i class="icon-home home-icon"></i>
                <a href="#">Home</a>
            </li>

            <li>
                <a href="#">Tables</a>
            </li>
            <li class="active">材料出库列表</li>
        </ul><!-- .breadcrumb -->

        <div class="nav-search" id="nav-search">
            <form class="form-search">
                <span class="input-icon">
                    <input type="text" placeholder="Search ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />
                    <i class="icon-search nav-search-icon"></i>
                </span>
            </form>
        </div><!-- #nav-search -->
    </div>

    <div class="page-content">
        <div class="row">
            <div class="col-xs-12">
                <h3 class="header smaller lighter blue">项目材料出库</h3>
                <div class="row">
                    <div class="col-xs-12">
                        <div class="table-responsive">
                            <table id="sample-table-2" class="table table-striped table-bordered table-hover">
                                <thead>
                                    <tr>
                                            <th>ID</th>
                                            <th>材料名称</th>
                                            <th>用材分部</th>
                                            <th>实际单价</th>
                                            <th>入库数量</th>
                                            <th>入库总价1</th>
                                            <th>库存</th>
                                            <th>更改状态</th>

                                    </tr>
                                </thead>
                                <tbody>
                                {volist name="list" id="v"}
                                    <tr>
                                            <td>{$v['id']}</td>
                                            <td>{$v['material_name']}</td>
                                            <td>{$v['timber_division']}</td>
                                            <td>{$v['actual_unit_price']}</td>
                                            <td>{$v['actual_out_number']}</td>
                                            <td>{$v['out_total_price']}</td>
                                            <td>{$v['in_stock']}</td>
                                        <td>
                                            <a href="{:url('admin/material/outWarehouse', ['id' => $v['id']])}"><span class="label label-lg label-yellow arrowed-in">出库</span></a>
                                            <button data-id="{$v['id']}"  class="btn btn-xs btn-danger del-btn" id="btn"  >删除</button>
                                        </td>
                                    </tr>
                                {/volist}
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div><!-- /.page-content -->
</div>
{/block}

{block name="myjs"}
<script>
    $('#add_Warehouse').click(function(){
        id= $('input[name="id"]').val();
//                 id= $('input[name="id"]').val();
//                console.log(id);
        upAjax(id);
    });

    function upAjax(id){
        $.ajax({
            type:'post',
            url: '/admin/Material/updaoteOutWarehouse/id/'+ id,
            dataType:'json',
            data: {
                id:$('input[name="id"]').val(),
                project_name:$('input[name="project_name"]').val(),
                material_name:$('input[name="material_name"]').val(),
                timber_division:$('input[name="timber_division"]').val(),
                actual_unit_price:$('input[name="actual_unit_price"]').val(),
                actual_in_number:$('input[name="actual_in_number"]').val(),
                in_total_price:$('input[name="in_total_price"]').val(),
                in_stock:$('input[name="in_stock"]').val()

            },

            success: function (data) {
                console.log(data);
                if (data.status) {
                    alert('成功');
                } else {
                    alert('失败');
                }
            },
            error: function () {
                alert('更新执行失败');
            }
        });
    }

</script>

{/block}